<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:composite="http://xmlns.jcp.org/jsf/composite">

    <h:body>
        <composite:interface>
            <composite:attribute name="bean" required="true"/>
        </composite:interface>

        <composite:implementation>
            <h:form id="relocatingFilterForm">
                <p:dialog id="relocatingFilterDialog" header="#{messages.Relocating}" modal="true" position="top" closable="false" resizable="false" widgetVar="relocatingFilterDialog">
                    <p:panel id="relocatingFilterPanel" styleClass="noBorder noPadding noMargin">
                        <p:selectOneButton value="#{cc.attrs.bean.relocatingOrCollector.importance}" styleClass="width100 marginBottom05em">  
                            <f:selectItem itemLabel="#{messages.Obligatory}" itemValue="#{cc.attrs.bean.obligatory}" />  
                            <f:selectItem itemLabel="#{messages.Important}" itemValue="#{cc.attrs.bean.important}" />  
                            <f:selectItem itemLabel="#{messages.Normal}" itemValue="#{cc.attrs.bean.normal}" />  
                        </p:selectOneButton>

                        <p:selectOneMenu required="false" filter="true" filterMatchMode="contains" requiredMessage="#{messages.CountryRequired}" converter="#{countryConverter}" id="selectRelocatingOrCountry" value="#{cc.attrs.bean.relocatingOrCollector.country}" effect="fade" label="#{messages.CountryText}">  
                            <f:selectItem itemLabel="#{messages.CountryText}" itemValue="" />  
                            <f:selectItem itemLabel="#{countryBundle[resourcesBean.spain.idCountry.toString()]}" itemValue="#{resourcesBean.spain}" /> 
                            <f:selectItems value="#{userResourcesBean.countries}" var="relocatingOrCountry" itemLabel="#{countryBundle[relocatingOrCountry.idCountry.toString()]}" itemValue="#{relocatingOrCountry}"/>  
                            <p:ajax event="change" update="butonAddLanguageOr selectOrProvince"/>
                        </p:selectOneMenu>

                        <p:selectOneMenu filter="true" filterMatchMode="contains" required="false" requiredMessage="#{messages.ProvinceRequired}" converter="#{provinceConverter}" id="selectOrProvince" value="#{cc.attrs.bean.relocatingOrCollector.province}" effect="fade" label="#{messages.ProvinceText}">  
                            <f:selectItem itemLabel="#{messages.AnyProvince}" itemValue="" />  
                            <f:selectItems value="#{cc.attrs.bean.relocatingOrCollector.country.provinceList}" var="relocatingOrProvince" itemLabel="#{relocatingOrProvince.description}" itemValue="#{relocatingOrProvince}"/>  
                            <p:ajax event="change" update="butonAddLanguageOr"/>
                        </p:selectOneMenu>
                        <p:commandButton process="@parent" disabled="#{cc.attrs.bean.relocatingOrCollector.country==null and cc.attrs.bean.relocatingOrCollector.province==null}" styleClass="blueBackgroundStrong" id="butonAddLanguageOr" value="#{messages.Add}" actionListener="#{cc.attrs.bean.addSearchRelocatingInfoRequeriment()}" oncomplete="if (args &amp;&amp; !args.validationFailed){PF('relocatingFilterDialog').hide();reinitWaypoint();}" update=":createSearchForm:searchPanel :facesPanel :totalFacesForm"/>
                        <p:commandButton value="#{messages.Cancel}" process="@this" styleClass="grayBackgroundStrong" style="margin-left: 3%;" actionListener="#{cc.attrs.bean.reinitSearchRelocatingRequeriment()}" update=":createSearchForm:searchPanel :createSearchForm:addFilterPanel" oncomplete="PF('relocatingFilterDialog').hide();"/>
                    </p:panel>
                </p:dialog>
            </h:form>
        </composite:implementation>
    </h:body>
</html>